/*
 * Created on May 25, 2004
 */

package org.vectrics.recruiter.struts.tag;

import java.util.HashSet;
import java.util.Set;

import org.vectrics.domain.Domain;
import org.vectrics.gui.RowDisplayOptions;
import org.vectrics.hibernate.ThreadProperties;
import org.vectrics.provider.CoreServiceLocator;
import org.vectrics.recruiter.config.RecruitConfig;

/**
 * @author mmoore
 */
public class JobDetailDisplayOptions extends RowDisplayOptions {
	public static final int STYLE_RECORD_PER_LINE = 0;
	public static final int STYLE_BLOCK = 1;
	
	private int rowStyle = STYLE_RECORD_PER_LINE;
	private boolean showIcon = false;
	private boolean showApprovalGroups = false;
	private boolean showDescription = false;
	private boolean showCompany = true;
	private boolean showCompanyCode = false;
	private boolean showDivision = false;
	private boolean showManager = false;
	private boolean showRecruiter = false;
	private boolean showFeatured = false;
	private boolean showLocation = false;
	private boolean showReferenceCode = false;
	private boolean showPdfLink = false;
	private boolean showApprovalGroup = false;
	private boolean showStatus = true;
	
	public JobDetailDisplayOptions() {
		super();
	}
	
	
	public boolean getShowStatus() {
		return showStatus;
	}


	public void setShowStatus(boolean showStatus) {
		this.showStatus = showStatus;
	}


	/**
	 * @return Returns the showCompany.
	 */
	public boolean getShowCompany() {
		return showCompany;
	}
	/**
	 * @param showCompany The showCompany to set.
	 */
	public void setShowCompany(boolean showCompany) {
		this.showCompany = showCompany;
	}
	/**
	 * @return Returns the showDescription.
	 */
	public boolean getShowDescription() {
		return showDescription;
	}
	/**
	 * @param showDescription The showDescription to set.
	 */
	public void setShowDescription(boolean showDescription) {
		this.showDescription = showDescription;
	}
	/**
	 * @return Returns the showDivision.
	 */
	public boolean getShowDivision() {
		return showDivision;
	}
	/**
	 * @param showDivision The showDivision to set.
	 */
	public void setShowDivision(boolean showDivision) {
		this.showDivision = showDivision;
	}
	/**
	 * @return Returns the showManager.
	 */
	public boolean getShowManager() {
		return showManager;
	}
	/**
	 * @param showManager The showManager to set.
	 */
	public void setShowManager(boolean showManager) {
		this.showManager = showManager;
	}
	/**
	 * @return Returns the showRecruiter.
	 */
	public boolean getShowRecruiter() {
		return showRecruiter;
	}
	/**
	 * @param showRecruiter The showRecruiter to set.
	 */
	public void setShowRecruiter(boolean showRecruiter) {
		this.showRecruiter = showRecruiter;
	}
	/**
	 * @return Returns the rowStyle.
	 */
	public int getRowStyle() {
		return rowStyle;
	}
	/**
	 * @param rowStyle The rowStyle to set.
	 */
	public void setRowStyle(int rowStyle) {
		this.rowStyle = rowStyle;
	}
	/**
	 * @return Returns the showFeatured.
	 */
	public boolean getShowFeatured() {
		return showFeatured;
	}
	/**
	 * @param showFeatured The showFeatured to set.
	 */
	public void setShowFeatured(boolean showFeatured) {
		this.showFeatured = showFeatured;
	}

	/**
	 * @return Returns the showLocation.
	 */
	public boolean getShowLocation() {
		return showLocation;
	}

	/**
	 * @param showLocation The showLocation to set.
	 */
	public void setShowLocation(boolean showLocation) {
		this.showLocation = showLocation;
	}

	/**
	 * @return Returns the showCompanyCode.
	 */
	public boolean getShowCompanyCode() {
		return showCompanyCode;
	}

	/**
	 * @param showCompanyCode The showCompanyCode to set.
	 */
	public void setShowCompanyCode(boolean showCompanyCode) {
		this.showCompanyCode = showCompanyCode;
	}

	/**
	 * @return Returns the showReferenceCode.
	 */
	public boolean getShowReferenceCode() {
		return showReferenceCode;
	}

	/**
	 * @param showReferenceCode The showReferenceCode to set.
	 */
	public void setShowReferenceCode(boolean showReferenceCode) {
		this.showReferenceCode = showReferenceCode;
	}

	/**
	 * @return Returns the showPdfLink.
	 */
	public boolean getShowPdfLink() {
		return showPdfLink;
	}

	/**
	 * @param showPdfLink The showPdfLink to set.
	 */
	public void setShowPdfLink(boolean showPdfLink) {
		this.showPdfLink = showPdfLink;
	}


	public boolean getShowApprovalGroups() {
		return showApprovalGroups;
	}

	public void setShowApprovalGroups(boolean showApprovalGroups) {
		this.showApprovalGroups = showApprovalGroups;
	}

	
	public void setDefaultOptions() {
		if (RecruitConfig.getRecruitInstance().getShowJobListCompanyCode(ThreadProperties.getDomain()) == true)
			this.setShowCompanyCode(true);
		else
			this.setShowCompanyCode(false);

		Domain domain = ThreadProperties.getDomain();

		Set domains = new HashSet();
		domains.add(ThreadProperties.getDomain());
		int companyCount = 	CoreServiceLocator.getCompanyService()
				.findCompaniesForDomains(domains).size();

		if (companyCount > 1) {
			this.setShowCompany(true);
		} else {
			this.setShowCompany(false);
		}

		if (RecruitConfig.getRecruitInstance().getShowJobListIcon(domain) == true)
			this.setShowActiveIndicator(true);
		else
			this.setShowActiveIndicator(false);
		
		if (RecruitConfig.getRecruitInstance().getShowJobListReferenceCode(domain) == true)
			this.setShowReferenceCode(true);
		else
			this.setShowReferenceCode(false);
		
	}
	
	public String toString() {
		return("rowStyle=" + this.rowStyle + "|showApprovalGroup" 
				+ this.showApprovalGroup + "|showApprovalGroups" + this.showApprovalGroups
				+ "|showCompany=" + this.showCompany
				+ "|showCompanyCode=" + this.showCompanyCode
				+ "|showDescription=" + this.showDescription
				+ "|showDivision=" + this.showDivision
				+ "|showStatus=" + this.showStatus
				+ "|showIcon=" + this.showIcon
				+ "|showFeatured=" + this.showFeatured
				+ "|showLocation=" + this.showLocation
				+ "|showManager=" + this.showManager
				)
				;
	}
}
